<cfsetting enablecfoutputonly="false" showdebugoutput="false">
<!---
	Name         : RSS
	Author       : Raymond Camden 
	Created      : March 12, 2003
	Last Updated : November 13, 2003
	History      : Reset history for version 3.0
				   Forgot to remove val() on cat and entry since they are not uuids (rkc 11/13/03)
	Purpose		 : Blog RSS feed.
--->

<cfif isDefined("url.mode") and url.mode is "full">
	<cfset mode = "full">
<cfelse>
	<cfset mode = "short">
</cfif>

<!---
	FB41 version of blog creates mode=xxx&do=blog.yyy&... URL
	where yyy is equivalent to the old mode2 flag
--->
<cfif structKeyExists(URL,"do")>
	<cfif listFirst(URL.do,".") is "blog">
		<cfset URL.mode2 = listLast(URL.do,".")/>
	</cfif>
</cfif>

<cfset params = structNew()>

<cfif isDefined("url.mode2")>
	<cfif url.mode2 is "day" and isDefined("url.day") and isDefined("url.month") and isDefined("url.year")>
		<cfset params.byDay = val(url.day)>
		<cfset params.byMonth = val(url.month)>
		<cfset params.byYear = val(url.year)>
	<cfelseif url.mode2 is "month" and isDefined("url.month") and isDefined("url.year")>
		<cfset params.byMonth = val(url.month)>
		<cfset params.byYear = val(url.year)>
	<cfelseif url.mode2 is "cat" and isDefined("url.catid")>
		<cfset params.byCat = url.catid>
	<cfelseif url.mode2 is "entry">
		<cfset params.byEntry = url.entry>
	</cfif>
</cfif>


<cftry>
	<cfcontent type="text/xml"><cfoutput>#application.blog.generateRSS(mode=mode,params=params)#</cfoutput>
	<cfcatch>
		<cfmail to="#application.blog.getProperty('ownerEmail')#" from="#application.blog.getProperty('ownerEmail')#" subject="rss bug" type="html">
		Type=#cfcatch.type#
		<hr>
		Message=#cfcatch.message#
		<hr>
		Detail=#cfcatch.detail#
		<cfdump var="#cfcatch#">
		</cfmail>
		<!--- Logic is - if they filtered incorrectly, revert to default, if not, abort --->
		<cfif cgi.query_string neq "">
			<cflocation url="rss.cfm">
		<cfelse>
			<cfabort>
		</cfif>
	</cfcatch>
</cftry>
